﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PBOffice.Models;
using PBOffice.BLL;

public partial class MeetingRoomManager_MeetingRoomManager : System.Web.UI.Page
{
    List<MeetingRoom> list;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            list = new MeetingRoomManager().GetAllMeetingRoom();
            this.GridView1.DataSource = list;
            this.GridView1.DataBind();
        }
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string no = GridView1.Rows[e.RowIndex].Cells[0].Text;
        new MeetingRoomManager().DeleteMeetingRoom(no);
        list = new MeetingRoomManager().GetAllMeetingRoom();
        this.GridView1.DataSource = list;
        this.GridView1.DataBind();
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "modify")
        {
            GridViewRow dv = (GridViewRow)((ImageButton)(e.CommandSource)).Parent.Parent;
            string no = GridView1.Rows[dv.RowIndex].Cells[0].Text;
            Response.Redirect(string.Format("ModifyMeetingRoom.aspx?no={0}", no));
        }
    }
}